<template>
	<view class="box">
		<uNavbar title="福合通宝" bgColor="#211E38"></uNavbar>
		<view class="wrap">
			<view class="wrap_top">
				<view class="tit">
					可用福合通宝
				</view>
				<view class="num">
					{{num}}
				</view>
				<view class="line">
					
				</view>
				<view class="txt">
					1.福合通宝是福合宇宙·多彩王朝App内的流通凭证,唯一支付方式为内购方式购买，2.福合通宝获取方式：点击下方充值按钮即可获取福合通宝
				</view>
			</view>
			<view class="btn_wrap">
				<view class="btn1"  v-if="fictitiousState"    @click="iosTotopup">
					充值
				</view>
				<view class="btn1"  v-else @click="totopup">
					充值
				</view>
				<!-- <view class="btn2" @click="gofhzz">
					转赠
				</view> -->
				<view class="btn2" v-if="!fictitiousState"  @click="gowithdraw">
					提现
				</view>
			</view>
		</view>
		<view class="main">
			<view class="titt">
				福合通宝明细
			</view>
			<view class="main_item" v-for="item in zlist" :key="item.id">
				<view class="main_item_top">
					<view class="main_item_from">
						{{item.from_desc}}
					</view>
					<view class="main_item_price">
						{{item.amount}}
					</view>
				</view>
				<view class="main_item_bottom">
					<view class="main_item_text">
						余额：{{item.after}}
					</view>
					<view class="main_item_time">
						{{item.create_time}}
					</view>
				</view>
			</view>
			<noDatas :xxxList="zlist" :status="status"></noDatas>
		</view>
	</view>

</template>

<script>
	import {balancelist,myAccount} from "../../api/wallet.js"
	export default {
		data() {
			return {
				page: 1,
				size: 10,
				status: 'loadmore', //加载前值为loadmore，加载中为loading，没有数据为nomore
				zlist: [],
				isopen: false, //是否开通钱包
				num:"0.00",
				fictitiousState:false
				
				
			}
		},
		onShow() {
			this.fictitiousState = uni.getStorageSync('fictitiousState')
			console.log(this.fictitiousState);
			this.getmyAccount()
			this.getlist()
		},
		methods: {
			getmyAccount() {
				myAccount().then(res => {
					this.isopen = res.data.switch
					this.num=res.data.balance
				})
			},
			gofhzz(){
				uni.navigateTo({
					url:"/pagesMy/mywallet/fhdonation"
				})
			},
			iosTotopup() {
				uni.navigateTo({
					url:"/pagesMy/mywallet/iosTopupfh"
				})
			},
			totopup() {
				// uni.navigateTo({
				// 	url:"/pagesMy/mywallet/proceeds"
				// })
				if (this.isopen) {
					this.gotopup()
				} else {
					uni.$u.toast("请开通钱包")
				}
			},
			gotopup() {
				uni.navigateTo({
					url: "/pagesMy/mywallet/topupfh"
				})
			},
			gowithdraw() {
					// uni.$u.toast("敬请期待，功能暂未开放")
				if (this.isopen) {
					uni.navigateTo({
						url: "/pagesMy/mywallet/withdrawwallet"
					})
				} else {
					uni.$u.toast("请开通钱包")
				}
			
			},
			getlist() {
				balancelist({
					page: this.page
				}).then(res => {
					if (res.code == 1) {
						let list = res.data.data;
						this.zlist = this.page == 1 ? list : this.zlist.concat(list);
						console.log(this.zlist);
						if (list.length < this.size) this.status = 'nomore';
						else this.status = 'loading';
					}
				})
			}
		},
		onReachBottom() {
			if (this.status != 'nomore') {
				this.page = this.page + 1
				this.getlist()
			}
		},
	}
</script>

<style lang="scss" scoped>
	.box {
		width: 750rpx;
		height: 100vh;
		background-color: #211E38;
		
	}

	.main {
		width: 690rpx;
		margin-top: 40rpx;
		border-radius: 20rpx;
		margin: 0 auto;
		margin-top: 32rpx;
		background: #3C2F65;
		padding-bottom: 60rpx;
		.titt{
			width: 690rpx;
			text-align: center;
			font-weight: 400;
			font-size: 36rpx;
			color: #FFFFFF;
			padding-top: 38rpx;
			margin-bottom: 30rpx;
		}
		.main_item {
			width: 690rpx;
			height: 150rpx;
			background: #3C2F65;
			// border-radius: 16rpx 16rpx 16rpx 16rpx;
			margin: 0 auto;
			// margin-bottom: 30rpx;
			.main_item_top {
				display: flex;
				justify-content: space-between;

				.main_item_from {
					font-size: 28rpx;
					color: #FFFFFF;
					margin: 24rpx;
				}

				.main_item_price {
					font-weight: 500;
					font-size: 36rpx;
					color: #FFFFFF;
					margin: 24rpx;
				}
			}
			.main_item_bottom{
				display: flex;
				justify-content: space-between;
				.main_item_text{
					font-size: 24rpx;
					color: #A6A5AF;
					margin-left: 24rpx;
				}
				.main_item_time{
					font-weight: 400;
					font-size: 24rpx;
					color: #A6A5AF;
					margin-right: 24rpx;
				}
			}
		}
	}
	.wrap{
		width: 690rpx;
		margin: 0 auto;
		height: 500rpx;
		background-color: #3C2F65;
		border-radius: 16rpx 16rpx 16rpx 16rpx;
		.wrap_top{
			width: 690rpx;
			height: 352rpx;
			background-image: url("../../static/image/ddd.png");
			background-size: 690rpx 352rpx;
			.tit{
				font-weight: 400;
				font-size: 36rpx;
				color: #FFFFFF;
				padding-top: 32rpx;
				margin-left: 32rpx;
			}
			.num{
				margin-top: 22rpx;
				margin-left: 32rpx;
				font-weight: 700;
				font-size: 52rpx;
				color: #FFFFFF;
			}
			.line{
				width: 620rpx;
				height: 0rpx;
				margin: 0 auto;
				margin-top: 30rpx;
				border-bottom: 2rpx solid rgba(255,255,255,0.1);
			}
			.txt{
				width: 642rpx;
				height: 118rpx;
				margin: 0 auto;
				font-weight: 400;
				margin-top: 22rpx;
				font-size: 26rpx;
				color: rgba(255,255,255,0.8);
			}
		}
		.btn_wrap{
			width: 690rpx;
			margin-top: 40rpx;
			display: flex;
			justify-content: space-around;
			align-items: center;
			.btn1{
				width: 200rpx;
				height: 64rpx;
				background: linear-gradient( 274deg, #0014FF 0%, #8020EF 50%, #FF2CDF 100%);
				box-shadow: 0rpx 8rpx 12rpx 2rpx rgba(59,8,71,0.3);
				border-radius: 536rpx 536rpx 536rpx 536rpx;
				text-align: center;
				line-height: 64rpx;
				font-weight: 500;
				font-size: 28rpx;
				color: #FFFFFF;
			}
			.btn2{
				width: 200rpx;
				height: 64rpx;
				background: #53418C;
				box-shadow: 0rpx 8rpx 12rpx 2rpx rgba(59,8,71,0.3);
				border-radius: 536rpx 536rpx 536rpx 536rpx;
				text-align: center;
				line-height: 64rpx;
				font-weight: 500;
				font-size: 28rpx;
				color: #FF2CDF;
			}
		}
	}
</style>